package org.swift.mashup.engine.concurrency.agenda;

public class ThreadMonitor {
	
	public static enum Status {
		IDLE, RUNNING, FINISHED, FAILED, TIMEDOUT, ABORTED
	};

	private Thread thread = null;

	private Status status = Status.IDLE;

	public ThreadMonitor() {
	}

	public ThreadMonitor(Status status) {
		this.setStatus(status);
	}

	public ThreadMonitor(Thread thread) {
		this.setThread(thread);
	}

	
	public ThreadMonitor(Thread thread, Status status) {
		this.setThread(thread);
		this.setStatus(status);
	}

	public ThreadMonitor(Thread thread, int timeout) {
		this.setThread(thread);		
	}
	
	public void resetStatus() {
		this.setStatus(Status.IDLE);
	}

	public Thread getThread() {
		return this.thread;
	}

	public void setThread(Thread thread) {
		this.thread = thread;
	}

	public Status getStatus() {
		return this.status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

    @Override
    public String toString() {
        return "ThreadMonitor{" +
                "status=" + status.name() +
                ", thread=" + String.valueOf(thread) +
                '}';
    }
}
